home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / tcl / dist6.3 / tclUnixStr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-30  |  14.9 KB  |  725 lines

  1. /* 
  2.  * tclUnixStr.c --
  3.  *
  4.  *    This file contains procedures that generate strings
  5.  *    corresponding to various UNIX-related codes, such
  6.  *    as errno and signals.
  7.  *
  8.  * Copyright 1991 Regents of the University of California
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that this copyright
  12.  * notice appears in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  */
  17.  
  18. #ifndef lint
  19. static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclUnixStr.c,v 1.12 92/04/30 15:51:15 ouster Exp $ SPRITE (Berkeley)";
  20. #endif /* not lint */
  21.  
  22. #include "tclInt.h"
  23. #include "tclUnix.h"
  24.  
  25. /*
  26.  *----------------------------------------------------------------------
  27.  *
  28.  * Tcl_ErrnoId --
  29.  *
  30.  *    Return a textual identifier for the current errno value.
  31.  *
  32.  * Results:
  33.  *    This procedure returns a machine-readable textual identifier
  34.  *    that corresponds to the current errno value (e.g. "EPERM").
  35.  *    The identifier is the same as the #define name in errno.h.
  36.  *
  37.  * Side effects:
  38.  *    None.
  39.  *
  40.  *----------------------------------------------------------------------
  41.  */
  42.  
  43. char *
  44. Tcl_ErrnoId()
  45. {
  46.     switch (errno) {
  47. #ifdef E2BIG
  48.     case E2BIG: return "E2BIG";
  49. #endif
  50. #ifdef EACCES
  51.     case EACCES: return "EACCES";
  52. #endif
  53. #ifdef EADDRINUSE
  54.     case EADDRINUSE: return "EADDRINUSE";
  55. #endif
  56. #ifdef EADDRNOTAVAIL
  57.     case EADDRNOTAVAIL: return "EADDRNOTAVAIL";
  58. #endif
  59. #ifdef EADV
  60.     case EADV: return "EADV";
  61. #endif
  62. #ifdef EAFNOSUPPORT
  63.     case EAFNOSUPPORT: return "EAFNOSUPPORT";
  64. #endif
  65. #ifdef EAGAIN
  66.     case EAGAIN: return "EAGAIN";
  67. #endif
  68. #ifdef EALIGN
  69.     case EALIGN: return "EALIGN";
  70. #endif
  71. #ifdef EALREADY
  72.     case EALREADY: return "EALREADY";
  73. #endif
  74. #ifdef EBADE
  75.     case EBADE: return "EBADE";
  76. #endif
  77. #ifdef EBADF
  78.     case EBADF: return "EBADF";
  79. #endif
  80. #ifdef EBADFD
  81.     case EBADFD: return "EBADFD";
  82. #endif
  83. #ifdef EBADMSG
  84.     case EBADMSG: return "EBADMSG";
  85. #endif
  86. #ifdef EBADR
  87.     case EBADR: return "EBADR";
  88. #endif
  89. #ifdef EBADRPC
  90.     case EBADRPC: return "EBADRPC";
  91. #endif
  92. #ifdef EBADRQC
  93.     case EBADRQC: return "EBADRQC";
  94. #endif
  95. #ifdef EBADSLT
  96.     case EBADSLT: return "EBADSLT";
  97. #endif
  98. #ifdef EBFONT
  99.     case EBFONT: return "EBFONT";
  100. #endif
  101. #ifdef EBUSY
  102.     case EBUSY: return "EBUSY";
  103. #endif
  104. #ifdef ECHILD
  105.     case ECHILD: return "ECHILD";
  106. #endif
  107. #ifdef ECHRNG
  108.     case ECHRNG: return "ECHRNG";
  109. #endif
  110. #ifdef ECOMM
  111.     case ECOMM: return "ECOMM";
  112. #endif
  113. #ifdef ECONNABORTED
  114.     case ECONNABORTED: return "ECONNABORTED";
  115. #endif
  116. #ifdef ECONNREFUSED
  117.     case ECONNREFUSED: return "ECONNREFUSED";
  118. #endif
  119. #ifdef ECONNRESET
  120.     case ECONNRESET: return "ECONNRESET";
  121. #endif
  122. #if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
  123.     case EDEADLK: return "EDEADLK";
  124. #endif
  125. #ifdef EDEADLOCK
  126.     case EDEADLOCK: return "EDEADLOCK";
  127. #endif
  128. #ifdef EDESTADDRREQ
  129.     case EDESTADDRREQ: return "EDESTADDRREQ";
  130. #endif
  131. #ifdef EDIRTY
  132.     case EDIRTY: return "EDIRTY";
  133. #endif
  134. #ifdef EDOM
  135.     case EDOM: return "EDOM";
  136. #endif
  137. #ifdef EDOTDOT
  138.     case EDOTDOT: return "EDOTDOT";
  139. #endif
  140. #ifdef EDQUOT
  141.     case EDQUOT: return "EDQUOT";
  142. #endif
  143. #ifdef EDUPPKG
  144.     case EDUPPKG: return "EDUPPKG";
  145. #endif
  146. #ifdef EEXIST
  147.     case EEXIST: return "EEXIST";
  148. #endif
  149. #ifdef EFAULT
  150.     case EFAULT: return "EFAULT";
  151. #endif
  152. #ifdef EFBIG
  153.     case EFBIG: return "EFBIG";
  154. #endif
  155. #ifdef EHOSTDOWN
  156.     case EHOSTDOWN: return "EHOSTDOWN";
  157. #endif
  158. #ifdef EHOSTUNREACH
  159.     case EHOSTUNREACH: return "EHOSTUNREACH";
  160. #endif
  161. #ifdef EIDRM
  162.     case EIDRM: return "EIDRM";
  163. #endif
  164. #ifdef EINIT
  165.     case EINIT: return "EINIT";
  166. #endif
  167. #ifdef EINPROGRESS
  168.     case EINPROGRESS: return "EINPROGRESS";
  169. #endif
  170. #ifdef EINTR
  171.     case EINTR: return "EINTR";
  172. #endif
  173. #ifdef EINVAL
  174.     case EINVAL: return "EINVAL";
  175. #endif
  176. #ifdef EIO
  177.     case EIO: return "EIO";
  178. #endif
  179. #ifdef EISCONN
  180.     case EISCONN: return "EISCONN";
  181. #endif
  182. #ifdef EISDIR
  183.     case EISDIR: return "EISDIR";
  184. #endif
  185. #ifdef EISNAME
  186.     case EISNAM: return "EISNAM";
  187. #endif
  188. #ifdef ELBIN
  189.     case ELBIN: return "ELBIN";
  190. #endif
  191. #ifdef EL2HLT
  192.     case EL2HLT: return "EL2HLT";
  193. #endif
  194. #ifdef EL2NSYNC
  195.     case EL2NSYNC: return "EL2NSYNC";
  196. #endif
  197. #ifdef EL3HLT
  198.     case EL3HLT: return "EL3HLT";
  199. #endif
  200. #ifdef EL3RST
  201.     case EL3RST: return "EL3RST";
  202. #endif
  203. #ifdef ELIBACC
  204.     case ELIBACC: return "ELIBACC";
  205. #endif
  206. #ifdef ELIBBAD
  207.     case ELIBBAD: return "ELIBBAD";
  208. #endif
  209. #ifdef ELIBEXEC
  210.     case ELIBEXEC: return "ELIBEXEC";
  211. #endif
  212. #ifdef ELIBMAX
  213.     case ELIBMAX: return "ELIBMAX";
  214. #endif
  215. #ifdef ELIBSCN
  216.     case ELIBSCN: return "ELIBSCN";
  217. #endif
  218. #ifdef ELNRNG
  219.     case ELNRNG: return "ELNRNG";
  220. #endif
  221. #ifdef ELOOP
  222.     case ELOOP: return "ELOOP";
  223. #endif
  224. #ifdef EMFILE
  225.     case EMFILE: return "EMFILE";
  226. #endif
  227. #ifdef EMLINK
  228.     case EMLINK: return "EMLINK";
  229. #endif
  230. #ifdef EMSGSIZE
  231.     case EMSGSIZE: return "EMSGSIZE";
  232. #endif
  233. #ifdef EMULTIHOP
  234.     case EMULTIHOP: return "EMULTIHOP";
  235. #endif
  236. #ifdef ENAMETOOLONG
  237.     case ENAMETOOLONG: return "ENAMETOOLONG";
  238. #endif
  239. #ifdef ENAVAIL
  240.     case ENAVAIL: return "ENAVAIL";
  241. #endif
  242. #ifdef ENET
  243.     case ENET: return "ENET";
  244. #endif
  245. #ifdef ENETDOWN
  246.     case ENETDOWN: return "ENETDOWN";
  247. #endif
  248. #ifdef ENETRESET
  249.     case ENETRESET: return "ENETRESET";
  250. #endif
  251. #ifdef ENETUNREACH
  252.     case ENETUNREACH: return "ENETUNREACH";
  253. #endif
  254. #ifdef ENFILE
  255.     case ENFILE: return "ENFILE";
  256. #endif
  257. #ifdef ENOANO
  258.     case ENOANO: return "ENOANO";
  259. #endif
  260. #if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
  261.     case ENOBUFS: return "ENOBUFS";
  262. #endif
  263. #ifdef ENOCSI
  264.     case ENOCSI: return "ENOCSI";
  265. #endif
  266. #ifdef ENODATA
  267.     case ENODATA: return "ENODATA";
  268. #endif
  269. #ifdef ENODEV
  270.     case ENODEV: return "ENODEV";
  271. #endif
  272. #ifdef ENOENT
  273.     case ENOENT: return "ENOENT";
  274. #endif
  275. #ifdef ENOEXEC
  276.     case ENOEXEC: return "ENOEXEC";
  277. #endif
  278. #ifdef ENOLCK
  279.     case ENOLCK: return "ENOLCK";
  280. #endif
  281. #ifdef ENOLINK
  282.     case ENOLINK: return "ENOLINK";
  283. #endif
  284. #ifdef ENOMEM
  285.     case ENOMEM: return "ENOMEM";
  286. #endif
  287. #ifdef ENOMSG
  288.     case ENOMSG: return "ENOMSG";
  289. #endif
  290. #ifdef ENONET
  291.     case ENONET: return "ENONET";
  292. #endif
  293. #ifdef ENOPKG
  294.     case ENOPKG: return "ENOPKG";
  295. #endif
  296. #ifdef ENOPROTOOPT
  297.     case ENOPROTOOPT: return "ENOPROTOOPT";
  298. #endif
  299. #ifdef ENOSPC
  300.     case ENOSPC: return "ENOSPC";
  301. #endif
  302. #ifdef ENOSR
  303.     case ENOSR: return "ENOSR";
  304. #endif
  305. #ifdef ENOSTR
  306.     case ENOSTR: return "ENOSTR";
  307. #endif
  308. #ifdef ENOSYM
  309.     case ENOSYM: return "ENOSYM";
  310. #endif
  311. #ifdef ENOSYS
  312.     case ENOSYS: return "ENOSYS";
  313. #endif
  314. #ifdef ENOTBLK
  315.     case ENOTBLK: return "ENOTBLK";
  316. #endif
  317. #ifdef ENOTCONN
  318.     case ENOTCONN: return "ENOTCONN";
  319. #endif
  320. #ifdef ENOTDIR
  321.     case ENOTDIR: return "ENOTDIR";
  322. #endif
  323. #if defined(ENOTEMPTY) && (!defined(EEXIST) || (ENOTEMPTY != EEXIST))
  324.     case ENOTEMPTY: return "ENOTEMPTY";
  325. #endif
  326. #ifdef ENOTNAM
  327.     case ENOTNAM: return "ENOTNAM";
  328. #endif
  329. #ifdef ENOTSOCK
  330.     case ENOTSOCK: return "ENOTSOCK";
  331. #endif
  332. #ifdef ENOTTY
  333.     case ENOTTY: return "ENOTTY";
  334. #endif
  335. #ifdef ENOTUNIQ
  336.     case ENOTUNIQ: return "ENOTUNIQ";
  337. #endif
  338. #ifdef ENXIO
  339.     case ENXIO: return "ENXIO";
  340. #endif
  341. #ifdef EOPNOTSUPP
  342.     case EOPNOTSUPP: return "EOPNOTSUPP";
  343. #endif
  344. #ifdef EPERM
  345.     case EPERM: return "EPERM";
  346. #endif
  347. #ifdef EPFNOSUPPORT
  348.     case EPFNOSUPPORT: return "EPFNOSUPPORT";
  349. #endif
  350. #ifdef EPIPE
  351.     case EPIPE: return "EPIPE";
  352. #endif
  353. #ifdef EPROCLIM
  354.     case EPROCLIM: return "EPROCLIM";
  355. #endif
  356. #ifdef EPROCUNAVAIL
  357.     case EPROCUNAVAIL: return "EPROCUNAVAIL";
  358. #endif
  359. #ifdef EPROGMISMATCH
  360.     case EPROGMISMATCH: return "EPROGMISMATCH";
  361. #endif
  362. #ifdef EPROGUNAVAIL
  363.     case EPROGUNAVAIL: return "EPROGUNAVAIL";
  364. #endif
  365. #ifdef EPROTO
  366.     case EPROTO: return "EPROTO";
  367. #endif
  368. #ifdef EPROTONOSUPPORT
  369.     case EPROTONOSUPPORT: return "EPROTONOSUPPORT";
  370. #endif
  371. #ifdef EPROTOTYPE
  372.     case EPROTOTYPE: return "EPROTOTYPE";
  373. #endif
  374. #ifdef ERANGE
  375.     case ERANGE: return "ERANGE";
  376. #endif
  377. #if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
  378.     case EREFUSED: return "EREFUSED";
  379. #endif
  380. #ifdef EREMCHG
  381.     case EREMCHG: return "EREMCHG";
  382. #endif
  383. #ifdef EREMDEV
  384.     case EREMDEV: return "EREMDEV";
  385. #endif
  386. #ifdef EREMOTE
  387.     case EREMOTE: return "EREMOTE";
  388. #endif
  389. #ifdef EREMOTEIO
  390.     case EREMOTEIO: return "EREMOTEIO";
  391. #endif
  392. #ifdef EREMOTERELEASE
  393.     case EREMOTERELEASE: return "EREMOTERELEASE";
  394. #endif
  395. #ifdef EROFS
  396.     case EROFS: return "EROFS";
  397. #endif
  398. #ifdef ERPCMISMATCH
  399.     case ERPCMISMATCH: return "ERPCMISMATCH";
  400. #endif
  401. #ifdef ERREMOTE
  402.     case ERREMOTE: return "ERREMOTE";
  403. #endif
  404. #ifdef ESHUTDOWN
  405.     case ESHUTDOWN: return "ESHUTDOWN";
  406. #endif
  407. #ifdef ESOCKTNOSUPPORT
  408.     case ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT";
  409. #endif
  410. #ifdef ESPIPE
  411.     case ESPIPE: return "ESPIPE";
  412. #endif
  413. #ifdef ESRCH
  414.     case ESRCH: return "ESRCH";
  415. #endif
  416. #ifdef ESRMNT
  417.     case ESRMNT: return "ESRMNT";
  418. #endif
  419. #ifdef ESTALE
  420.     case ESTALE: return "ESTALE";
  421. #endif
  422. #ifdef ESUCCESS
  423.     case ESUCCESS: return "ESUCCESS";
  424. #endif
  425. #ifdef ETIME
  426.     case ETIME: return "ETIME";
  427. #endif
  428. #ifdef ETIMEDOUT
  429.     case ETIMEDOUT: return "ETIMEDOUT";
  430. #endif
  431. #ifdef ETOOMANYREFS
  432.     case ETOOMANYREFS: return "ETOOMANYREFS";
  433. #endif
  434. #ifdef ETXTBSY
  435.     case ETXTBSY: return "ETXTBSY";
  436. #endif
  437. #ifdef EUCLEAN
  438.     case EUCLEAN: return "EUCLEAN";
  439. #endif
  440. #ifdef EUNATCH
  441.     case EUNATCH: return "EUNATCH";
  442. #endif
  443. #ifdef EUSERS
  444.     case EUSERS: return "EUSERS";
  445. #endif
  446. #ifdef EVERSION
  447.     case EVERSION: return "EVERSION";
  448. #endif
  449. #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
  450.     case EWOULDBLOCK: return "EWOULDBLOCK";
  451. #endif
  452. #ifdef EXDEV
  453.     case EXDEV: return "EXDEV";
  454. #endif
  455. #ifdef EXFULL
  456.     case EXFULL: return "EXFULL";
  457. #endif
  458.     }
  459.     return "unknown error";
  460. }
  461.  
  462. /*
  463.  *----------------------------------------------------------------------
  464.  *
  465.  * Tcl_SignalId --
  466.  *
  467.  *    Return a textual identifier for a signal number.
  468.  *
  469.  * Results:
  470.  *    This procedure returns a machine-readable textual identifier
  471.  *    that corresponds to sig.  The identifier is the same as the
  472.  *    #define name in signal.h.
  473.  *
  474.  * Side effects:
  475.  *    None.
  476.  *
  477.  *----------------------------------------------------------------------
  478.  */
  479.  
  480. char *
  481. Tcl_SignalId(sig)
  482.     int sig;            /* Number of signal. */
  483. {
  484.     switch (sig) {
  485. #ifdef SIGABRT
  486.     case SIGABRT: return "SIGABRT";
  487. #endif
  488. #ifdef SIGALRM
  489.     case SIGALRM: return "SIGALRM";
  490. #endif
  491. #ifdef SIGBUS
  492.     case SIGBUS: return "SIGBUS";
  493. #endif
  494. #ifdef SIGCHLD
  495.     case SIGCHLD: return "SIGCHLD";
  496. #endif
  497. #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
  498.     case SIGCLD: return "SIGCLD";
  499. #endif
  500. #ifdef SIGCONT
  501.     case SIGCONT: return "SIGCONT";
  502. #endif
  503. #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
  504.     case SIGEMT: return "SIGEMT";
  505. #endif
  506. #ifdef SIGFPE
  507.     case SIGFPE: return "SIGFPE";
  508. #endif
  509. #ifdef SIGHUP
  510.     case SIGHUP: return "SIGHUP";
  511. #endif
  512. #ifdef SIGILL
  513.     case SIGILL: return "SIGILL";
  514. #endif
  515. #ifdef SIGINT
  516.     case SIGINT: return "SIGINT";
  517. #endif
  518. #ifdef SIGIO
  519.     case SIGIO: return "SIGIO";
  520. #endif
  521. #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGIOT != SIGABRT))
  522.     case SIGIOT: return "SIGIOT";
  523. #endif
  524. #ifdef SIGKILL
  525.     case SIGKILL: return "SIGKILL";
  526. #endif
  527. #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT))
  528.     case SIGLOST: return "SIGLOST";
  529. #endif
  530. #ifdef SIGPIPE
  531.     case SIGPIPE: return "SIGPIPE";
  532. #endif
  533. #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
  534.     case SIGPOLL: return "SIGPOLL";
  535. #endif
  536. #ifdef SIGPROF
  537.     case SIGPROF: return "SIGPROF";
  538. #endif
  539. #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
  540.     case SIGPWR: return "SIGPWR";
  541. #endif
  542. #ifdef SIGQUIT
  543.     case SIGQUIT: return "SIGQUIT";
  544. #endif
  545. #ifdef SIGSEGV
  546.     case SIGSEGV: return "SIGSEGV";
  547. #endif
  548. #ifdef SIGSTOP
  549.     case SIGSTOP: return "SIGSTOP";
  550. #endif
  551. #ifdef SIGSYS
  552.     case SIGSYS: return "SIGSYS";
  553. #endif
  554. #ifdef SIGTERM
  555.     case SIGTERM: return "SIGTERM";
  556. #endif
  557. #ifdef SIGTRAP
  558.     case SIGTRAP: return "SIGTRAP";
  559. #endif
  560. #ifdef SIGTSTP
  561.     case SIGTSTP: return "SIGTSTP";
  562. #endif
  563. #ifdef SIGTTIN
  564.     case SIGTTIN: return "SIGTTIN";
  565. #endif
  566. #ifdef SIGTTOU
  567.     case SIGTTOU: return "SIGTTOU";
  568. #endif
  569. #ifdef SIGURG
  570.     case SIGURG: return "SIGURG";
  571. #endif
  572. #ifdef SIGUSR1
  573.     case SIGUSR1: return "SIGUSR1";
  574. #endif
  575. #ifdef SIGUSR2
  576.     case SIGUSR2: return "SIGUSR2";
  577. #endif
  578. #ifdef SIGVTALRM
  579.     case SIGVTALRM: return "SIGVTALRM";
  580. #endif
  581. #ifdef SIGWINCH
  582.     case SIGWINCH: return "SIGWINCH";
  583. #endif
  584. #ifdef SIGXCPU
  585.     case SIGXCPU: return "SIGXCPU";
  586. #endif
  587. #ifdef SIGXFSZ
  588.     case SIGXFSZ: return "SIGXFSZ";
  589. #endif
  590.     }
  591.     return "unknown signal";
  592. }
  593.  
  594. /*
  595.  *----------------------------------------------------------------------
  596.  *
  597.  * Tcl_SignalMsg --
  598.  *
  599.  *    Return a human-readable message describing a signal.
  600.  *
  601.  * Results:
  602.  *    This procedure returns a string describing sig that should
  603.  *    make sense to a human.  It may not be easy for a machine
  604.  *    to parse.
  605.  *
  606.  * Side effects:
  607.  *    None.
  608.  *
  609.  *----------------------------------------------------------------------
  610.  */
  611.  
  612. char *
  613. Tcl_SignalMsg(sig)
  614.     int sig;            /* Number of signal. */
  615. {
  616.     switch (sig) {
  617. #ifdef SIGABRT
  618.     case SIGABRT: return "SIGABRT";
  619. #endif
  620. #ifdef SIGALRM
  621.     case SIGALRM: return "alarm clock";
  622. #endif
  623. #ifdef SIGBUS
  624.     case SIGBUS: return "bus error";
  625. #endif
  626. #ifdef SIGCHLD
  627.     case SIGCHLD: return "child status changed";
  628. #endif
  629. #if defined(SIGCLD) && (!defined(SIGCHLD) || (SIGCLD != SIGCHLD))
  630.     case SIGCLD: return "child status changed";
  631. #endif
  632. #ifdef SIGCONT
  633.     case SIGCONT: return "continue after stop";
  634. #endif
  635. #if defined(SIGEMT) && (!defined(SIGXCPU) || (SIGEMT != SIGXCPU))
  636.     case SIGEMT: return "EMT instruction";
  637. #endif
  638. #ifdef SIGFPE
  639.     case SIGFPE: return "floating-point exception";
  640. #endif
  641. #ifdef SIGHUP
  642.     case SIGHUP: return "hangup";
  643. #endif
  644. #ifdef SIGILL
  645.     case SIGILL: return "illegal instruction";
  646. #endif
  647. #ifdef SIGINT
  648.     case SIGINT: return "interrupt";
  649. #endif
  650. #ifdef SIGIO
  651.     case SIGIO: return "input/output possible on file";
  652. #endif
  653. #if defined(SIGIOT) && (!defined(SIGABRT) || (SIGABRT != SIGIOT))
  654.     case SIGIOT: return "IOT instruction";
  655. #endif
  656. #ifdef SIGKILL
  657.     case SIGKILL: return "kill signal";
  658. #endif
  659. #if defined(SIGLOST) && (!defined(SIGIOT) || (SIGLOST != SIGIOT))
  660.     case SIGLOST: return "resource lost";
  661. #endif
  662. #ifdef SIGPIPE
  663.     case SIGPIPE: return "write on pipe with no readers";
  664. #endif
  665. #if defined(SIGPOLL) && (!defined(SIGIO) || (SIGPOLL != SIGIO))
  666.     case SIGPOLL: return "input/output possible on file";
  667. #endif
  668. #ifdef SIGPROF
  669.     case SIGPROF: return "profiling alarm";
  670. #endif
  671. #if defined(SIGPWR) && (!defined(SIGXFSZ) || (SIGPWR != SIGXFSZ))
  672.     case SIGPWR: return "power-fail restart";
  673. #endif
  674. #ifdef SIGQUIT
  675.     case SIGQUIT: return "quit signal";
  676. #endif
  677. #ifdef SIGSEGV
  678.     case SIGSEGV: return "segmentation violation";
  679. #endif
  680. #ifdef SIGSTOP
  681.     case SIGSTOP: return "stop";
  682. #endif
  683. #ifdef SIGSYS
  684.     case SIGSYS: return "bad argument to system call";
  685. #endif
  686. #ifdef SIGTERM
  687.     case SIGTERM: return "software termination signal";
  688. #endif
  689. #ifdef SIGTRAP
  690.     case SIGTRAP: return "trace trap";
  691. #endif
  692. #ifdef SIGTSTP
  693.     case SIGTSTP: return "stop signal from tty";
  694. #endif
  695. #ifdef SIGTTIN
  696.     case SIGTTIN: return "background tty read";
  697. #endif
  698. #ifdef SIGTTOU
  699.     case SIGTTOU: return "background tty write";
  700. #endif
  701. #ifdef SIGURG
  702.     case SIGURG: return "urgent I/O condition";
  703. #endif
  704. #ifdef SIGUSR1
  705.     case SIGUSR1: return "user-defined signal 1";
  706. #endif
  707. #ifdef SIGUSR2
  708.     case SIGUSR2: return "user-defined signal 2";
  709. #endif
  710. #ifdef SIGVTALRM
  711.     case SIGVTALRM: return "virtual time alarm";
  712. #endif
  713. #ifdef SIGWINCH
  714.     case SIGWINCH: return "window changed";
  715. #endif
  716. #ifdef SIGXCPU
  717.     case SIGXCPU: return "exceeded CPU time limit";
  718. #endif
  719. #ifdef SIGXFSZ
  720.     case SIGXFSZ: return "exceeded file size limit";
  721. #endif
  722.     }
  723.     return "unknown signal";
  724. }
  725.